Fix 'BYTES' field handling on Py3k.#2818
Merged
tseaver merged 1 commit intogoogleapis:masterfrom Dec 6, 2016
tseaver:2815-bigquery-py3k-bytes-field
Merged
Fix 'BYTES' field handling on Py3k.#2818tseaver merged 1 commit intogoogleapis:masterfrom tseaver:2815-bigquery-py3k-bytes-field
tseaver merged 1 commit intogoogleapis:masterfrom
tseaver:2815-bigquery-py3k-bytes-field
Conversation
dhermes
reviewed
Dec 5, 2016
| if _not_null(value, field): | ||
| return base64.decodestring(value) | ||
| return base64.decodestring( | ||
| value.encode('ascii') if isinstance(value, six.text_type) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
dhermes
approved these changes
Dec 5, 2016
Contributor
dhermes
left a comment
There was a problem hiding this comment.
LGTM, but please use the core helper
JSON decodes the base64-encoded bits as text, which cannot be passed to 'base64.decodestring' on Py3k.
Contributor
|
@tseaver: See "but please use the core helper" |
Contributor
Author
|
@dhermes I updated it (via |
dhermes
reviewed
Dec 6, 2016
| if _not_null(value, field): | ||
| return base64.decodestring(value) | ||
| return base64.decodestring( | ||
| _to_bytes(value) if isinstance(value, six.text_type) else value) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
dhermes
added a commit
to dhermes/google-cloud-python
that referenced
this pull request
Dec 6, 2016
dhermes
added a commit
that referenced
this pull request
Dec 6, 2016
Follow-up to #2818, use _to_bytes as intended in BigQuery.
richkadel
pushed a commit
to richkadel/google-cloud-python
that referenced
this pull request
May 6, 2017
…tes-field Fix 'BYTES' field handling on Py3k.
richkadel
pushed a commit
to richkadel/google-cloud-python
that referenced
this pull request
May 6, 2017
richkadel
pushed a commit
to richkadel/google-cloud-python
that referenced
this pull request
May 6, 2017
Follow-up to googleapis#2818, use _to_bytes as intended in BigQuery.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSON decodes the base64-encoded bits as text, which cannot be passed to 'base64.decodestring' on Py3k.
tox -e system-tests3was failing for me locally before this patch, and passes with it.